#include <iostream>
#include <map>

using namespace std;

string getHint(string secret, string guess) {
    int i = 0, bulls = 0, cows = 0; map<char, int> mp;
    while(i < secret.size()){
        if(secret[i] == guess[i]){
            bulls++;
            secret.erase(i, 1); guess.erase(i, 1);
        }else{
            auto it = mp.insert({secret[i++], 1});
            if(!it.second) it.first->second++;
        }
    }
    while(i > 0){
        if(mp.find(guess[--i]) != mp.end()){
            auto it = mp.find(guess[i]);
            cows++;
            if(--it->second == 0){
                mp.erase(guess[i]);
            } 
        }
    }
    return to_string(bulls) + "A" + to_string(cows) + "B";
}

int main(){
    string secret = "00112233445566778899", guess = "16872590340158679432";
    cout << getHint(secret, guess) << endl;
    return 0;
}